<?php
/**
 * Created by PhpStorm.
 * User: 我型我素
 * Date: 2018/2/2
 * Time: 9:18
 */

namespace App\Services\Common;


class BaseService
{
    public $error = 0;
    public $errorMsg = "";
    public $result = [];

    public function __construct(){

    }

    public function setSuccessStatus(array $data,String $msg,String $errorCode){
        $this->error = !empty($errorCode) ? $errorCode : 0;
        $this->errorMsg = !empty($msg) ? $msg : "success";
        $this->result = $data;
    }

    public function setFailStatus(String $msg,String $errorCode,array $data){
        $this->error = !empty($errorCode) ? $errorCode : 1;
        $this->errorMsg = !empty($msg) ? $msg : "fail";
        $this->result = $data;
    }

    public function setServiceStatusInfo($Service){
        $this->error = $Service->error;
        $this->errorMsg = $Service->errorMsg;
        $this->result = $Service->result;
    }

    public function getServiceStatusInfo(){
        return $this;
    }

    public function getStatusResult(){
        return $this->result;
    }

    public function getErrorCode(){
        return $this->error;
    }

    public function getMsg(){
        return $this->errorMsg;
    }

}